/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow
 */

import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View, TouchableOpacity} from 'react-native';

export default class detail extends React.Component{
	render() {
	    return ( 
	    	<View style={styles.container}>
          <TouchableOpacity onPress={this._pressBackButton.bind(this)}>
            <Text style={styles.back}>返回</Text>
          </TouchableOpacity>
          <Text style={styles.text}>
            {this.props.productTitle}
          </Text>
          <Text style={styles.text}>
            {this.props.toString()}
          </Text>
        </View>
	    );
    }
    _pressBackButton(){
      const {navigator} = this.props;
      if(navigator){
        navigator.pop()
      }
    }
}

const styles = StyleSheet.create({
    container:{
      flex: 1,
      backgroundColor: 'gray',
      justifyContent: 'center',
      alignItems: 'center'
    },
    text:{
      fontSize: 20
    },
    back:{
      fontSize: 20,
      color: 'blue'
    }
});